package com.wjz.admin.config;

import com.wjz.admin.aop.ApiInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

/**
 * @Description: API 拦截器配置
 * @Author: jzq
 * @Create: 2022/1/4
 */
@Configuration
public class ApiInterceptorConfig implements WebMvcConfigurer {

    @Resource
    private ApiInterceptor apiInterceptor;

    /**
     * 注册拦截器
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(apiInterceptor).addPathPatterns("/**")
        .excludePathPatterns("/api/user/logout", "/api/user/login", "/api/user/create", "/swagger-ui/index.html");
    }


}
